package com.tedu.jiaodanote.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tedu.jiaodanote.entry.User;
import com.tedu.jiaodanote.mapper.UserMapper;
import com.tedu.jiaodanote.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Author：毕龙
 * Date: 2024/7/9 14:26
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public boolean login(User user) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.like("username", user.getUsername());
        User userData = userMapper.selectOne(wrapper);
        if(userData == null){
            return false;
        }
        if(!userData.getPassword().equals( user.getPassword())){
            return false;
        }
        return true;
    }
}
